import GlobalRouter from "@/components/globalRouter";
import { mainRoutes } from "./main-routes";
import { lazy, Suspense } from "react";

const Login = lazy(() => import("@/pages/login"));
const NotFound = lazy(() => import("@/pages/error/404"));

export const routes = [
  {
    path: "/",
    element: <GlobalRouter />, // 路由中间件
    children: [
      ...mainRoutes,
      {
        path: "login",
        element: (
          <Suspense>
            <Login />
          </Suspense>
        ),
        meta: {
          title: "登录",
          isShowNav: false,
        },
      },
      {
        path: "*",
        element: (
          <Suspense>
            <NotFound />
          </Suspense>
        ),
        meta: {
          title: "404",
          isShowNav: false,
        },
      },
    ],
    meta: {
      title: "后端管理系统",
      isShowNav: false,
    },
  },
];
